package com.chentf.common.exception;

import com.chentf.common.result.ResponseEnum;
import lombok.Data;

/**
 * @author chentengfei
 * @desc 自定义全局异常
 * @date 2021-11-02 22:24:56
 */
@Data
public class SrbCustomerException extends RuntimeException {

    private Integer code;

    public SrbCustomerException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public SrbCustomerException(ResponseEnum responseEnum) {
        super(responseEnum.getMessage());
        this.code = responseEnum.getCode();
    }

    @Override
    public String toString() {
        return "SrbCustomerException{" + "code=" + code + ", message=" + this.getMessage() + '}';
    }
}
